package dreampharos.dao;

import java.io.Reader;
import java.sql.SQLException;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import dreampharos.dto.CreditDTO;
import dreampharos.dto.CurriculumDTO;
import dreampharos.dto.PotentialDTO;

public class CurriculumDAO {

	private static SqlMapClient sqlmap;
	
	static{
		try{
			String xmlPath="/dreampharos/dao/SqlMapConfig.xml";
			Reader reader=Resources.getResourceAsReader(xmlPath);
			sqlmap=SqlMapClientBuilder.buildSqlMapClient(reader);
		}catch(Exception ex){
			System.out.println("SqlMapConfig Parsing Error()"+ex.getMessage());
		}
	}

	public static CurriculumDTO viewPortfolio(String id) throws SQLException{
		
		return (CurriculumDTO)sqlmap.queryForObject("viewPortfolio", id);
	}
	
	public static CreditDTO viewCredit(String id) throws SQLException{
		
		return (CreditDTO)sqlmap.queryForObject("viewCredit", id);
	}


	public static PotentialDTO viewMajor(String id) throws SQLException{
		
		return (PotentialDTO)sqlmap.queryForObject("getMainGoalPotential", id);
	}
	
	
}
